import pymysql

conn = pymysql.connect(host='localhost',user='root',passwd='123456',db='test01',charset='utf8')

cursor = conn.cursor()

cursor2 = conn.cursor()



cursor.execute("select * from t_book;")

res1 = cursor.fetchone()
print("res1:",res1)
res2 = cursor.fetchone()
print("res2:",res2)
cursor.rownumber = 0
res3 = cursor.fetchmany(2)
print("res3:",res3)
cursor2.rownumber = 3
res4 = cursor.fetchall()
print("res4:",res4)
cursor.rownumber = 0
res5 = cursor.fetchall()
print("res5:",res5)



cursor.close()

conn.close()